﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Confirm.aspx.cs" Inherits="AiRiZu.User.Confirm" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>
	爱日租—全球最时尚、最具先锋概念的房屋日租、短租服务网站！
</title>
<meta content="爱日租,日租,短租,租房,家庭公寓,自助公寓,家庭旅馆,旅游" name="keywords"/>
<meta content="爱日租是国内首家专注房屋短期租赁的信息发布和在线交易的网站，为房主和租户搭建起最值得信赖的沟通和交易平台" name="description"/>

<link rel="stylesheet" href="css/css.css" />
<link rel="stylesheet" href="css/howitworks.css" />
<link rel="stylesheet" href="css/common.css" />
<link rel="stylesheet" href="css/pixie.css" />
<link rel="stylesheet" href="css/dashboard.css" />
<link rel="stylesheet" href="css/search.css" />
<link rel="stylesheet" href="css/voucher.css" />
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
<link href="css/book_it_from.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-ui.min.js"></script>
<script type="text/javascript" src="js/jquery.imgareaselect.min.js"></script>
<script type="text/javascript" src="js/application6.js"></script>
<script type="text/javascript" src="js/home.js"></script>
<script type="text/javascript" src="js/translate.js"></script>
<script type="text/javascript" src="js/s_code.js?vid=1"></script>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="layout" content="main"/>
<link href="/css/book_it_form.css"
	rel="stylesheet" type="text/css" />
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function submit_comit(){
	if(!is_check_pass()){
		alert('手机号通过校验，方可预订');
		return ;
	}
	document.forms[2].submit();
}

$(function(){
	
		genrate_guest_infor();
	
})

function doSubmit(e) {
	$.get('/ajax/validateBook?r=' + Math.random(), 
		{roomId: "12797", checkin: $('#checkIn').val(), checkout: $('#checkOut').val() }, 
		function(json){
			
			if(json == 'nologin'){
				
				$('#login_logout').show();
			}else if(json == "success"){
				
				e.className = 'btn green_gray';
				submit_comit();
			}else if(json == 'back'){
				window.history.go(-1);
			}
	})
	
}

//登录
function login(){
	var email = $('#login_email').val();
	var pwd = $('#login_password').val();
	$.post('/ajax/login', {email: email, password: pwd}, function(json){
		//alert(json)
		if(json == "success"){
			$('#guest_information').css('display', 'inline-block');
			genrate_guest_infor();
			$('#login_logout').hide();
		}else{
			alert(json)
		}
	})
}
//注册
function regist(){
	var email = $('#regist_email').val();
	var phoneNumber = $('#regist_num').val();
	var serviceTerms = $('#serviceTerms').attr('checked') ? 1 : 0
	//alert(serviceTerms)
	$.post('/ajax/regist', {email: email, phoneNumber: phoneNumber, serviceTerms: serviceTerms}, function(json){
		//alert(json)
		if(json == "success"){
			//设置租可信息可见
			genrate_guest_infor();
			$('#login_logout').hide();
		}else{
			alert(json)
		}
	})
}

function set_total_money(){
	var code = $('#vouchers').val();
	var total = parseInt("99.0");
	var checkIn = $('#checkIn').val();
	$.get("/ajax/searchVouchers?r=" + Math.random(), {vouchers: code, totalPrice: total, checkIn: checkIn}, function(msg){
		var json = eval('('+ msg +')')
		if(json.status == 1){
			$('#book_room_total_price').text(json.message);
			$('#need_to_pay_total_price').text(json.message);
			$('#book_room_deposit').text(json.message * 99.0);
		}else{
			$('#book_room_total_price').text(total)
			$('#need_to_pay_total_price').text(total)
			$('#book_room_deposit').text(total * 99.0);
			alert(json.message);
		}
	})
	
}

function is_check_pass(){
	return $('#is_check_pass').val() == '1' ? true : false
}

function genrate_guest_infor(){
	$.get('/ajax/sessionUser?r=' + Math.random(), function(user){
		load_check_phone(function(h){
			$('#guest_information').html(['<div class="wrap_price">',
				'<h2>租客信息</h2>',
				'<table border="0" cellpadding="0" cellspacing="0">',
					'<tbody>',
						'<tr>',
							'<th style="width:242px">租客姓名</th>',
							'<td>',user.firstName, user.lastName, '</td>',
						'</tr>',
						'<tr>',
							'<th style="width:242px">电子邮件</th>',
							'<td>',user.email, '</td>',
						'</tr>',
						'<tr>',
							'<th style="width:242px">手机号码</th>',
							'<td>',user.phoneNumber,
								h,
							'</td>',
						'</tr>',
					'</tbody>',
				'</table>',
			'</div>'].join(''))
		})

	})
	
}

function load_check_phone(callback){
	$.get('/ajax/checkPhoneNumber?r=' + Math.random(), function(json){
		//alert(json.status_1 + ':::' + json.status_2 + '::' + json.status_3)
		callback(generate_check_phone(json))
	})
}
function generate_check_phone(s){
	return [(s.status_1 == 1 ? ['<p class="ly-validate-send">',
				'<a href="javascript:void(0)" class="ly-validate-btn"',
					'onclick="validate_phone_send_code(this, false)">发送验证码',
				'</a><span class="ly-redBox">验证后可赢取300租币</span>',
			'</p>'].join('') : ''),
			
			(s.status_2 == 1 ? ['<p class="ly-validate">',
				'<input  class="ly-validate-input" ',
					'type="text" /><a href="javascript:void(0)" class="ly-validate-btn"',
					'onclick="validate_check_code(this, \'2\')">验证</a><a ',
					'href="javascript:void(0)" class="ly-grayBtn"',
					'onclick="validate_phone_send_code(this, true)">重新发送</a>',
			'</p>'].join('') : ['<p class="ly-validate" style="display: none;">',
				'<input class="ly-validate-input" ',
					'type="text" /><a href="javascript:void(0)" class="ly-validate-btn"',
					'onclick="validate_check_code(this, \'2\')">验证</a><a ',
					'href="javascript:void(0)" class="ly-grayBtn"',
					'onclick="validate_phone_send_code(this, true)">重新发送</a>',
			'</p>'].join('')),
			(s.status_3 == 1 ? ['<input type="hidden" id="is_check_pass" value="1" />',
       			'<p class="ly-validate-ok">',
   				'<span class="ly-greenBox">验证通过</span>',
   			'</p>'].join('') : ['<input type="hidden" id="is_check_pass" value="0" />',
         			'<p class="ly-validate-ok" style="display: none;">',
   				'<span class="ly-greenBox">验证通过</span>',
   			'</p>'].join(''))].join('');
}


function validate_check_code(self, type){
	//校验验证码是否争取
	$.post('/ajax/checkCode?r=' + Math.random(), {code: $(self).prev().val(), type: type}, 
    	function(json){
    	if(json == '1'){
			//成功
    		$(self).parent().next().css('display', 'inline-block');
    		$(self).parent().hide();
    		$('#is_check_pass').val(1)
    		$('#submit-btn-confirm').attr('class', 'btn green')
	    }else{
			alert('您输入的校验码错误')
		}
	})
}

function validate_phone_send_code(self, resend){
	//校验phone同时发送checkcode
	$.post('/ajax/vPhoneSendCode?r=' + Math.random(), {phone: $('#phone_check').val()}, 
    	function(json){
    	if(json == '1'){
			//成功 
			if(!resend){
	    		$(self).parent().next().css('display', 'inline-block');
	    		$(self).parent().hide();
			}

			alert('校验码发送成功')
	    }
	})
}
//-->
</script>


<script type="text/javascript">

$(document).ready(function(){
        opts = {};
        AirbnbHomePage.init(opts);
    });

function addEventHandler(target, type, func) { 
    if (target.addEventListener) 
        target.addEventListener(type, func, false); 
    else if (target.attachEvent) 
        target.attachEvent("on" + type, func); 
    else target["on" + type] = func; 
} 
addEventHandler(document, 'scroll', function() {
	document.getElementById('list_loading').style.top = $('body').scrollTop() + 'px';
});

function shiftLanguage(lang, country) {
	$.ajax({
		   type: "POST",
		   url: "/ajax/versionInternationalize",
		   data: 'lang=' + lang + '&country=' + country,
		   success: function(msg){
		   	   if(msg == 'success') {
		   	   	   window.location.reload(true);
		   	   }
		   }
		 });
}

$(document).bind('click',function(event){  
    var url = event.target.href;
    if(event.target.parentNode.href) {
		url = event.target.parentNode.href;
    }
    if(url && url.indexOf('http://') == 0) {
    	if(url.indexOf("?") != -1 && (url.indexOf("/city") != -1 || url.indexOf("/list") != -1 || url.indexOf("/show") != -1)) {
	    	post_to_url(url);
	        event.preventDefault();  
	        event.stopPropagation();
    	}  
    }  
      
},true);

function post_to_url(url) {
	var flag = false; // 目录到/room/show页面时是弹出新窗口，flag = false 不弹出，true是弹出
	if(url.indexOf("/room/show") != -1 && url.indexOf("?src=list") != -1){
        flag = true;
    }

    var form = document.createElement("form");
    var baseUrl = url.substring(0, url.indexOf("?"));
    var params = url.substring(url.indexOf("?") + 1, url.length);
    params = decodeURIComponent(params);
    params = params.replace("+", " ");
    var s = params.split("&");
    form.setAttribute("method", "post");
    form.setAttribute("action", baseUrl);
    for(var i = 0; i < s.length; i ++) {
        var hiddenField = document.createElement("input");
        hiddenField.setAttribute("type", "hidden");
        hiddenField.setAttribute("name", s[i].split("=")[0].replace('locationSearch', 'location'));
        hiddenField.setAttribute("value", s[i].split("=")[1]);
        form.appendChild(hiddenField);
    }
    $('body').append(form);
    if(flag){
        form.target="_blank"; // /room/show 新窗口弹出
    }
    
    form.submit();
}
</script>

<!--google analytics-->
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-22185191-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

</head>
<body>
<form runat="server">
	<div name="waitingDiv" id="waitingDiv" style="display: none;">
		<div id="list_loading" name="list_loading">
			<div id="list_loading_wrapper" class="rounded_more">
				<img src="/images/home_spinner.gif"
					style="display: block; float: left; padding: 0 12px 0 0;" />页面载入中...
			</div>
		</div>
	</div></div>
	<div name="waitingDiv" id="Div1" style="display: none;">
		<div id="Div2" name="list_loading">
			<div id="Div3" class="rounded_more">
				<img src="/images/home_spinner.gif"
					style="display: block; float: left; padding: 0 12px 0 0;" />页面载入中...
			</div>
		</div>
	</div></div>
	<div class="header">
	    <a class="logo" title="爱日租" href="../default.aspx"></a>
	    <div class="top_bar">
		    <ul class="nav">
			
		        <li>
		            <span class="SayHi"><%=Session["aliance"] != null? "嗨! " + Session["aliance"].ToString() : ""%></span>
		        </li>

				<li>
				    <a href="DashBoard.aspx">用户中心</a>
				</li>
				    <li>
					    <strong>
						    <a href="/message/inbox?offset=0" class="message">
							    <span id="unReadMessages"></span>
						    </a>
					    </strong>
					</li>
					
					<li class="rounded">
					    <asp:HyperLink ID="HyperLink1" runat="server" ></asp:HyperLink>
						<a href="javascript:void(0)" onclick="AddFavorite(window.location,document.title)">收藏</a>
							<%--收藏--%>
						<%--<span class="star" title="收藏" id="userFavorites"></span></a>--%>
					</li>
				<script type="text/javascript" language="javascript">
				    function AddFavorite(sURL, sTitle) {
				        try {
				            window.external.addFavorite(sURL, sTitle);
				        }
				        catch (e) {
				            try {
				                window.sidebar.addPanel(sTitle, sURL, "");
				            }
				            catch (e) {
				                alert("加入收藏失败，请使用Ctrl+D进行添加");
				            }
				        }
				    }
                    
                </script>

				<li>
				        <asp:LinkButton id="logoutButton" runat="server" onclick="logoutButton_Click">退出</asp:LinkButton>
				    
				</li>
				
			
				<li style="display:none"><span class="ChoLanguage selected">
				<a href="#">简体中文</a></span></li>
                <li style="display:none"><span class="EngLanguage">
       	        <a href="#">English</a></span></li>
	     
			
			
		</ul>
		<a href="../SendRoom.aspx" class="btn list_your_space">
			<span>发布房间</span>		</a>		</div>
		<p class="customer_hot_line"><span>400-696-6656</span><a href="#">媒体报道</a></p>
	</div>
	

	
<div class="ly-pop-login" style="display:none; top: 350px;" id="login_logout">
<div class="ly-wrap-pop ly-wrap-pop-login">
  <div class="wrap_l_r l_r_left">
    <div class="wrap_right">
      <div class="l_r_title_big">
        <h2>登录</h2>
      </div>
      <form>
        <table>
          <caption>
          <span>普通登录</span>
          </caption>
          <tbody>
            <tr>
              <th><label for="">邮件地址</label></th>
              <td><input id="login_email" name="email" tabindex="" type="text" value="" class="input_a"/></td>
              <td class="t_tips"></td>
            </tr>
            <tr>
              <th><label for="">密码</label></th>
              <td><input id="login_password" name="password" tabindex="" type="password" value="" class="input_a"/></td>
              <td class="t_tips"><a href="#">忘记密码？</a></td>
            </tr>
            <tr>
              <th></th>
              <td><input type="checkbox" name="" id="" class="checkbox_a"/>
                记住登录状态</td>
              <td class="t_tips"></td>
            </tr>
            <tr>
              <th></th>
              <td><a href="javascript:void(0)" class="btn green" onclick="login()"><span>登录</span></a></td>
              <td></td>
            </tr>
          </tbody>
          </table>
      </form>
      <table>
        <caption>
        <span>使用合作网站账号登录</span>
        </caption>
        <tbody>
          <tr>
            <td class="other_login"><img src="/css/images/pic/qq_login.png" width="120" height="35" />
            <img src="/css/images/pic/sina_login.png" width="120" height="35" />
            <img src="/css/images/pic/renren_login.png" width="120" height="35" />
            <img src="/css/images/pic/kaixin_login.png" width="120" height="35" /></td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
  <div class="wrap_l_r l_r_right" style="opacity: 1;">
    <div class="wrap_right">
      <div class="l_r_title_big">
        <h2>注册</h2>
      </div>
      <form>
        <table>
          <tbody>
            <tr>
              <th><label for="">电子邮件</label></th>
              <td><input id="regist_email" name="email" tabindex="" type="text" value="" class="input_a"/></td>
            </tr>
            <tr>
              <th><label for="">移动电话</label></th>
              <td><input id="regist_num" name="phoneNumber" tabindex="" type="text" value="" class="input_a"/></td>
            </tr>
            <tr>
              <th>&nbsp;</th>
              <td colspan="2"><label for=""><input type="checkbox" id="serviceTerms" name="serviceTerms" checked/>我已阅读并同意爱日租<a href="/terms" target="_blank">服务条款</a></label></td>
            </tr>
            <tr>
              <th></th>
              <td><a href="javascript:void(0)" class="btn blue" onclick="regist()"><span>注册</span></a></td>
            </tr>
          </tbody>
          </table>
      </form>
    </div>
  </div>
  <div class="clear"></div>
</div>
</div>
	
	
	
	<div>
	<%--<form action="/book/doConfirm/confirm_pay_form" method="post" >--%>
		<input type="hidden" name="roomId" id="roomId"
			value="12797">
		<input type="hidden" name="checkIn" id="checkIn"
			value="2011-10-14">
		<input type="hidden" name="checkOut" id="checkOut"
			value="2011-10-15">
		<input type="hidden" name="guestNum" id="guestNum"
			value="1">
		<input type="hidden" name="subtotalPrice" id="subtotalPrice"
			value="120.0">
		<input type="hidden" name="charges" id="charges"
			value="15.0">
		<input type="hidden" name="totalPrice" id="totalPrice"
			value="135.0">
		<input type="hidden" name="pricePerNight" id="pricePerNight"
			value="99.0">

		<input type="hidden" name="subtotalPriceAfterDiscount"
			id="subtotalPriceAfterDiscount"
			value="120.0">

		<input type="hidden" name="totalPriceAfterDiscount"
			id="totalPriceAfterDiscount"
			value="99.0">

		<input type="hidden" name="chargesAfterDiscount"
			id="chargesAfterDiscount"
			value="0.0">
			
		<input type="hidden" name="hostFee"
			id="hostFee"
			value="4.0">
			
		<input type="hidden" name="deposit" id="deposit" value="true">
		<input type="hidden" name="bank_type" id="bank_type" value="-1">
		
		</div>
		
		<div class="main">
			<div class="wrap_top"></div>
			<div class="wrap_book_it_form_top"></div>
			<div class="book_it_form_tips">
				如下是您的订单信息，请确认后提交。注意：<br />1. 在提交前请确认您的入住信息，提交后房东将会收到您的预订请求。<br />2.
				如果房东在48小时内接受或拒绝您的订房请求，我们将会用短信和邮件的方式来通知您。<br />3.
				如果您想取消预定，请登录爱日租，在"用户中心-出行计划-计划行程"页面点击取消订单。<br />如果您有其他疑问，请拨打我们客户电话：400-696-6656（工作时间周一到周五
				9:00 - 17:00）
			</div>
			<div class="book_it_form">
				<div class="room_pic">


<img height="140px" 
	width="210px"
	src="/upload/images/room/12797/0_small.JPEG?r=59.80882083223133"
	title='<%=RoomName%>'
	alt='<%=RoomName%>' width="210px"  class="main_photo"/>
				</div>
				<a href="/room/show/12797" target="_blank" class="room_title">
									<%=RoomName%> </a>
				<p class="room_address"><%=RoomAddr%></p>
				<table border="0" cellpadding="0" cellspacing="0" class="room_info">
					<thead>
						<tr>
							<th>入住日期</th>
							<th>退房日期</th>
							<th>几晚</th>
							<th>入住人数</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td><%=CheckInDate %><span class="date">
							(14:00以后)</span>
							</td>
							<td><%=CheckOutDate %><span class="date">
							(12:00以前)</span>
							</td>
							<td><%=NumOfNight %></td>
							<td><%=NumOfPeople %></td>
						</tr>
					</tbody>
				</table>
				<div class="wrap_price">
					<h2>价格</h2>
					<table border="0" cellpadding="0" cellspacing="0">
						<tbody>
							<tr>
								<th style="width:242px">小计</th>
								<td><%=SubtotalMoney %><sup>RMB</sup>
								</td>
							</tr>
							
							<tr>
								<th>应付总额</th>
								<td>
									<div class="tips">入住后评价房东还可<br />获得<em id="need_to_pay_total_price">99.0</em>租币</div>
									<span id="book_room_total_price"><%=TotalMoney%></span><sup>RMB</sup>
								</td>
							</tr>
							<tr class="embg">
								<th>支付订金</th>
								<td>
									<div class="tips">您现在不需要支付订金，在房东接受后，需要您回到爱日租支付订金，这样能保证房东给您留房，确保您能正常入住。</div>
									<span id="book_room_deposit"><%=FrontMoney%></span><sup>RMB</sup>
								</td>
							</tr>
						</tbody>
					</table>
				</div>
				<div id="guest_information"></div>
				<div class="wrap_payment">
					<div class="wrap_btn">
						<a class="btn green" href="javascript:void(0)" onClick="javascript:if(this.className == 'btn green') doSubmit(this);" id="submit-btn-confirm"><span>提交订单</span>
						</a>
					</div>
					<p class="tips">我已经确认订单信息并同意爱日租服务条款，且会按照订单上的预订日期正常入住 。</p>
					<div class="wrap_cancellation">
						
						<h3>订单取消</h3>
										<ol style="padding-left:10px">
											<li>1. 房东没有确认的订单：您可自行取消，或联系爱日租客服帮您取消，我们将不收取任何费用。</li>
											<li>2. 房东确认且未支付订金的订单：您可自行取消，或联系爱日租客服帮您取消，我们将不收取任何费用。</li>
											<li>3. 房东确认且已经支付订金的订单：如果您在入住前2天的中午12点前取消，我们将会扣除支付订金的10%作为违约金。如：您的入住日期为1月10日，建议您在1月8日中午12点前取消订单。</li>
											<li>4. 房东确认且已经支付订金的订单：如果您未能在入住前2天的中午12点前取消，您支付的订金将作为违约金用来补偿给房东。</li>
								        </ol>
						
					</div>
				</div>
			</div>
			<div class="clear"></div>
			<div class="wrap_bottom"></div>
		</div>
	</form>



	<!-- footer -->
	
<div id="footer">
  <p class="TxtEn">&copy; Copyright 2011 <a href="#">airizu.com 爱日租 版权所有</a>&nbsp;&nbsp;京ICP证110553 号
	 <br/>
	 <br/><img src="images/alipay.gif" width="123" height="40">&nbsp;&nbsp;
    <img src="images/tenpay.gif" width="96" height="40">&nbsp;&nbsp;    <img src="images/315.gif" width="89" height="40">    <img src="images/bluelogoair.gif"/></p>
</div>

</body>

</html>
